(function(w){
    var announceDetail = function(){
        this.Init();
        return this;
    },c = {},noticeId = getQueryString("objId"),objId = "",
        communityId = "",desc = "";

    announceDetail.prototype = {
        Init: function(){
            c = this;
            if(sessionStorage.loginData != null && sessionStorage.resUrl != null){
                //userId = eval( "(" + sessionStorage.loginData + ")").data[0].objId;
                //userId = "549968e5bc537bb017000a53";
            }else{
                location.href = "/pages/moderatorManager/html/login.html";//û���ݽ���¼ҳ
            }
            c.data = {"url":"/rest/v1.0/backoffice/communities/getNoticeById/"+noticeId};
            netWork(c.data,c.getAnnounceDetail);
        },
        getAnnounceDetail: function(data){
            var d = eval( "(" + data + ")"),date = formatTime(new Date(d.data.dateCreated));
            $("#title").text(d.data.title);
            $("#time").text(date);
            $("#content").html(d.data.desc);
            //$(".img-area img").attr("src",d.data.imageURL);
            objId = d.data.objId;
            communityId = d.data.community[0];
            desc = d.data.title;
        },
        pushHandle: function(data){
            var d = eval( "(" + data + ")");

        },
        evt: function(){
            $("#back").on("click",function(){
                location.href = "/pages/moderatorManager/html/announcement/announcement.html";
            });

            $("#push").on("click",function(){
                $("#alert_content_textarea").val($("#title").text());
                $("#content_push").css("display","block");
                $("#mask").css("display","block");
            });

            $("#push_cancel,#push_confirm").on("click",function(){
                $("#content_push").css("display","none");
                $("#mask").css("display","none");

                if(this.id == "push_confirm"){
                    var sendData = {"url":"/rest/v1.0/backoffice/Systems/confirmPushByModerator","method":"post","data": "contentId="+objId+"&communityId="+communityId+"&tag=公告"+"&content="+$("#alert_content_textarea").text()+"&type="+1+"&openType=2&desc="+desc};//createdBy=
                    netWork(sendData,c.pushHandle);
                }
            });

            //�������ж�
            $("#toast").on('webkitAnimationEnd', function(){
                this.className = "toast";
            }, false);
        }
    };

    w.announceDetail = announceDetail;
}(window))

new announceDetail().evt();